package com.lnsf.bookstore.web.userCoupon.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lnsf.bookstore.web.userCoupon.dao.ApiUserCouponMapper;
import com.lnsf.bookstore.web.userCoupon.service.ApiUserCouponService;
import com.lnsf.bookstore.web.userCoupon.vo.ApiUserCoupon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class ApiUserCouponServiceImpl implements ApiUserCouponService {

    @Autowired
    private ApiUserCouponMapper apiUserCouponMapper;

    @Override
    public PageInfo<ApiUserCoupon> queryAll(Map<String, Object> params) {
        PageHelper.startPage(Integer.parseInt(params.get("page").toString()),Integer.parseInt(params.get("limit").toString()));
        return new PageInfo<ApiUserCoupon>(apiUserCouponMapper.selectAll(params));
    }

    @Override
    public int save(ApiUserCoupon apiUserCoupon) {
        return apiUserCouponMapper.insertSelective(apiUserCoupon);
    }
}
